package com.edu.zhku.wms.pojo;

import com.edu.zhku.wms.common.Update;
import io.swagger.annotations.ApiModelProperty;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;

public class Wage implements Serializable {

    @NotNull(groups = Update.class, message = "ID不能为空")
    @ApiModelProperty(value = "工资表id")
    private Integer id;

    @ApiModelProperty(value = "基本工资")
    private BigDecimal basicWage;

    @ApiModelProperty(value = "福利工资")
    private BigDecimal welfareAllowance;

    @ApiModelProperty(value = "奖励工资")
    private BigDecimal bonusWage;

    @ApiModelProperty(value = "失业保险")
    private BigDecimal unemploymentInsurance;

    @ApiModelProperty(value = "住房公积金")
    private BigDecimal housingProvidentFund;

    @ApiModelProperty(value = "个人所得税")
    private BigDecimal personalIncomeTax;

    @ApiModelProperty(value = "其他组成")
    private BigDecimal other;

    @NotNull(message = "年份不能为空")
    @ApiModelProperty(value = "年")
    private Integer year;

    @NotNull(message = "月份不能为空")
    @Min(1)
    @Max(12)
    @ApiModelProperty(value = "月")
    private Integer month;

    @NotNull(message = "需要员工ID以指定员工")
    @ApiModelProperty(value = "员工id")
    private Integer employeeId;

    private static final long serialVersionUID = 1L;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public BigDecimal getBasicWage() {
        return basicWage;
    }

    public void setBasicWage(BigDecimal basicWage) {
        this.basicWage = basicWage;
    }

    public BigDecimal getWelfareAllowance() {
        return welfareAllowance;
    }

    public void setWelfareAllowance(BigDecimal welfareAllowance) {
        this.welfareAllowance = welfareAllowance;
    }

    public BigDecimal getBonusWage() {
        return bonusWage;
    }

    public void setBonusWage(BigDecimal bonusWage) {
        this.bonusWage = bonusWage;
    }

    public BigDecimal getUnemploymentInsurance() {
        return unemploymentInsurance;
    }

    public void setUnemploymentInsurance(BigDecimal unemploymentInsurance) {
        this.unemploymentInsurance = unemploymentInsurance;
    }

    public BigDecimal getHousingProvidentFund() {
        return housingProvidentFund;
    }

    public void setHousingProvidentFund(BigDecimal housingProvidentFund) {
        this.housingProvidentFund = housingProvidentFund;
    }

    public BigDecimal getPersonalIncomeTax() {
        return personalIncomeTax;
    }

    public void setPersonalIncomeTax(BigDecimal personalIncomeTax) {
        this.personalIncomeTax = personalIncomeTax;
    }

    public BigDecimal getOther() {
        return other;
    }

    public void setOther(BigDecimal other) {
        this.other = other;
    }

    public Integer getYear() {
        return year;
    }

    public void setYear(Integer year) {
        this.year = year;
    }

    public Integer getMonth() {
        return month;
    }

    public void setMonth(Integer month) {
        this.month = month;
    }

    public Integer getEmployeeId() {
        return employeeId;
    }

    public void setEmployeeId(Integer employeeId) {
        this.employeeId = employeeId;
    }

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Wage other = (Wage) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getBasicWage() == null ? other.getBasicWage() == null : this.getBasicWage().equals(other.getBasicWage()))
            && (this.getWelfareAllowance() == null ? other.getWelfareAllowance() == null : this.getWelfareAllowance().equals(other.getWelfareAllowance()))
            && (this.getBonusWage() == null ? other.getBonusWage() == null : this.getBonusWage().equals(other.getBonusWage()))
            && (this.getUnemploymentInsurance() == null ? other.getUnemploymentInsurance() == null : this.getUnemploymentInsurance().equals(other.getUnemploymentInsurance()))
            && (this.getHousingProvidentFund() == null ? other.getHousingProvidentFund() == null : this.getHousingProvidentFund().equals(other.getHousingProvidentFund()))
            && (this.getPersonalIncomeTax() == null ? other.getPersonalIncomeTax() == null : this.getPersonalIncomeTax().equals(other.getPersonalIncomeTax()))
            && (this.getOther() == null ? other.getOther() == null : this.getOther().equals(other.getOther()))
            && (this.getYear() == null ? other.getYear() == null : this.getYear().equals(other.getYear()))
            && (this.getMonth() == null ? other.getMonth() == null : this.getMonth().equals(other.getMonth()))
            && (this.getEmployeeId() == null ? other.getEmployeeId() == null : this.getEmployeeId().equals(other.getEmployeeId()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getBasicWage() == null) ? 0 : getBasicWage().hashCode());
        result = prime * result + ((getWelfareAllowance() == null) ? 0 : getWelfareAllowance().hashCode());
        result = prime * result + ((getBonusWage() == null) ? 0 : getBonusWage().hashCode());
        result = prime * result + ((getUnemploymentInsurance() == null) ? 0 : getUnemploymentInsurance().hashCode());
        result = prime * result + ((getHousingProvidentFund() == null) ? 0 : getHousingProvidentFund().hashCode());
        result = prime * result + ((getPersonalIncomeTax() == null) ? 0 : getPersonalIncomeTax().hashCode());
        result = prime * result + ((getOther() == null) ? 0 : getOther().hashCode());
        result = prime * result + ((getYear() == null) ? 0 : getYear().hashCode());
        result = prime * result + ((getMonth() == null) ? 0 : getMonth().hashCode());
        result = prime * result + ((getEmployeeId() == null) ? 0 : getEmployeeId().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", basicWage=").append(basicWage);
        sb.append(", welfareAllowance=").append(welfareAllowance);
        sb.append(", bonusWage=").append(bonusWage);
        sb.append(", unemploymentInsurance=").append(unemploymentInsurance);
        sb.append(", housingProvidentFund=").append(housingProvidentFund);
        sb.append(", personalIncomeTax=").append(personalIncomeTax);
        sb.append(", other=").append(other);
        sb.append(", year=").append(year);
        sb.append(", month=").append(month);
        sb.append(", employeeId=").append(employeeId);
        sb.append("]");
        return sb.toString();
    }
}
